package com.itheima.service.impl;

import com.itheima.mapper.ShoppingMapper;
import com.itheima.pojo.Shopping;
import com.itheima.pojo.ShoppingDTO;
import com.itheima.service.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class ShoppingServiceimpl implements ShoppingService {

    @Autowired
    private ShoppingMapper shoppingMapper;

    // 新增
    @Override
    public void save(Shopping shopping) {

        shoppingMapper.save(shopping);
    }

    // 根据ID查询
    @Override
    public Shopping getById(Long skuId) {

        Shopping list = shoppingMapper.getById(skuId);



        return list;
    }

    //分页
    @Override
    public List<Shopping> list(Integer page, Integer Size, ShoppingDTO shoppingDTO) {

      //  Integer pageNum = (page-1)*Size;

       List<Shopping> list =  shoppingMapper.list(page,Size,shoppingDTO);
        return list;
    }

    // 删除
    @Override
    public void delect(Long skuId) {
        shoppingMapper.delect(skuId);
    }

    // 修改
    @Override
    public void updete(Shopping shopping) {
        shoppingMapper.update(shopping);
    }


}
